package com.jxnu.duewang.zmly.zouZhen.adapter;

import androidx.databinding.BindingAdapter;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;

import android.widget.ImageView;

import com.jxnu.duewang.zmly.R;
import com.squareup.picasso.Picasso;

/**
 * Project Zmly
 * Author Duewang
 * Time 2016/12/7 0007
 */

public class ColumnBindingAdapter {

    @BindingAdapter("loadColumnImageUrl")
    public static void loadImage(ImageView view, String url){
        if (url!=null&&!url.isEmpty()){
            if (!"喜马拉雅".equals(url)) {
                Picasso.with(view.getContext()).load(url).resize(92,92).placeholder(R.mipmap.image_sound_default).error(R.mipmap.image_sound_default).into(view);
            }else {
                view.setImageResource(R.mipmap.image_sound_default);
//                Drawable drawable = ContextCompat.getDrawable(view.getContext(), R.mipmap.image_sound_default);
//                drawable.setBounds(0,0,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
//                view.setCompoundDrawables(null,drawable,null,null);
            }
        }
    }

}
